package etxt2db.annotators;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import edu.cmu.minorthird.text.Annotator;
import edu.cmu.minorthird.text.BasicTextLabels;
import edu.cmu.minorthird.text.MonotonicTextLabels;
import edu.cmu.minorthird.text.Span;
import edu.cmu.minorthird.text.TextLabels;
import etxt2db.api.ClassificationModel;
import etxt2db.corpus.CompleteTextLabels;


public class OverlapedTagClassificationModel extends ClassificationModel implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8472963663945665654L;
	List<Annotator> annotators = new ArrayList<Annotator>();
	
	public void addAnnotator(Annotator an){
		annotators.add(an);
	}
	
	public void annotate(MonotonicTextLabels arg0) {
		for(Annotator an : annotators){
			an.annotate(arg0);
		}
	}

	@Override
	public TextLabels annotatedCopy(TextLabels arg0) {
		CompleteTextLabels copy = new CompleteTextLabels(arg0.getTextBase());
		annotate(copy);
		//Return the new TextLabels
		return copy;
	}

	@Override
	public String explainAnnotation(TextLabels arg0, Span arg1) {
		//Not important in this work... but necessary to implement the interface
		return "";
	}
	
	public String getAlternateModelInfo(){
		String s = "";
		boolean hasStarted=false;
		for(Annotator a : annotators){
			if(!hasStarted){
				s=a.getAlternateModelInfo();
			}else{
				s+=a.getAlternateModelInfo();
			}
		}
		
		return s;
	}

}
